package 链表;

public class Main {
    public static void main(String[] args) {

        leetcode_链表 lc = new leetcode_链表();

        MyLinkedList list = new MyLinkedList();

        list.addAtHead(1);
        list.addAtHead(0);
        list.deleteAtIndex(2);
        System.out.println(list);


    }

    private static void testMerge() {
        ListNode l1 = new ListNode(1);
        l1.next =  new ListNode(2);
        l1.next.next =  new ListNode(4);
        l1.next.next.next = null;
        System.out.println(l1);

        ListNode l2 = new ListNode(1);
        l2.next =  new ListNode(3);
        l2.next.next =  new ListNode(4);
        l2.next.next.next = null;
        System.out.println(l2);

        leetcode_链表 lc = new leetcode_链表();
        ListNode newL = lc.mergeTwoLists(l1, l2);
    
        System.out.println(newL);

    }

    private static void testgetIntersectionNode() {
        ListNode tmp;

        ListNode l3 = new ListNode(1);
        tmp = l3;
        tmp.next =  new ListNode(2);
        tmp = tmp.next;

        tmp.next =  new ListNode(8);
        tmp = tmp.next;

        ListNode l1 = new ListNode(1);
        tmp = l1;
        tmp.next =  new ListNode(3);
        tmp = tmp.next;

        tmp.next =  new ListNode(4);
        tmp = tmp.next;

        tmp.next =  new ListNode(8);
        tmp = tmp.next;

        tmp.next =  l3;

        System.out.println(l1);

        ListNode l2 = new ListNode(1);

        tmp = l2;
        tmp.next =  new ListNode(2);
        tmp = tmp.next;

        tmp.next =  tmp.next =  l3;
        tmp = tmp.next;
        System.out.println(l2);

        leetcode_链表 lc = new leetcode_链表();

        ListNode newL = lc.getIntersectionNode(l1, l2);
    
        System.out.println(newL);
    }
    private static void testisPalindrome() {
        leetcode_链表 lc = new leetcode_链表();

        // testMerge();
        ListNode tmp;

        ListNode l3 = new ListNode(1);
        tmp = l3;
        // tmp.next =  new ListNode(1);
        // tmp = tmp.next;

        tmp.next =  new ListNode(2);
        tmp = tmp.next;

        tmp.next =  new ListNode(2);
        tmp = tmp.next;

        tmp.next =  new ListNode(1);
        tmp = tmp.next;

        tmp.next =  new ListNode(1);
        tmp = tmp.next;

        System.out.println(l3);

        System.out.println(lc.isPalindrome(l3));
    }
};